﻿using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Web.Routing;
using System.Web;

namespace DreamBox.Net.Web
{
    public static class ChildAction
    {
        public static void ActionHelper(RequestContext request, string boxName,string nameSpace, TextWriter textWriter)
        {
            RouteData routeData = new RouteData();
            routeData.Values.Add("Namespace", nameSpace);
            routeData.Values.Add("box",boxName);
            //routeData.Route = request.RouteData.Route;

            HttpContextBase httpContext = request.HttpContext;
            RequestContext requestContext = new RequestContext(httpContext, routeData);
            ChildActionMvcHandler handler = new ChildActionMvcHandler(requestContext);
            httpContext.Server.Execute(Http.HttpHandlerUtil.WrapForServerExecute(handler), textWriter, true /* preserveForm */);
        }


        internal class ChildActionMvcHandler : Http.HttpHandler
        {
            public ChildActionMvcHandler(RequestContext context)
                : base(context)
            {
            }
        }
    }
}
